package com.gp.study.mybatis.bind;

import java.lang.reflect.Proxy;

import com.gp.study.mybatis.session.DefaultSqlSession;

public class MapperProxyFactory {
	
	private Class<?> mapInterface;
	
	public MapperProxyFactory(Class<?> mapInterface) {
		this.mapInterface = mapInterface;
	}

	public <T> T newInstance(DefaultSqlSession sqlSession) {
		return (T) Proxy.newProxyInstance(mapInterface.getClassLoader(),new Class[]{mapInterface},new MapperProxy(sqlSession));
	}

}
